package com.gy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@SpringBootApplication
@RestController  //springboot 自带tomcat
public class Application extends SpringBootServletInitializer{

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
    
    //浏览器输入http://localhost:8080/testSpringBootStart 测试启动
    @RequestMapping("/testSpringBootStart")
    public String greeting() {
        return "Hello World!";
    }
    
    /*
     * gy
     * 重写父类的此方法的目的在于
     * 将springboot项目发布到tomcat容器启动
     */
    @Override
    protected SpringApplicationBuilder configure(
            SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
    
}
